package com.aofei.pangu.utils;

import me.goldze.mvvmhabit.authorization.Token;
import me.goldze.mvvmhabit.utils.SPUtils;

public class TokenManager {

    private static SPUtils spUtils = SPUtils.getInstance("refresh_token");

    private static final String ACCESS_TOKEN = "access_token";
    private static final String REFRESH_TOKEN = "refresh_token";

    public static String getAccessToken(){
       return   spUtils.getString(ACCESS_TOKEN);
    }
    public static void setAccessToken(String access_token){
        spUtils.put(ACCESS_TOKEN,access_token);
    }

    public static String getRefreshToken(){
        return   spUtils.getString(REFRESH_TOKEN);
    }
    public static void setRefreshToken(String refresh_token){
        spUtils.put(REFRESH_TOKEN,refresh_token);
    }

    public static void setToken(Token tokenInfo) {
        setAccessToken(tokenInfo.getAccess_token());
        setRefreshToken(tokenInfo.getRefresh_token());
    }
}
